<?php
// Copyright 2012 @Wondershare
// $Id: Authcode.php 437315 2012-08-01 03:20:12Z xuwh $

class Authcode{
    
    /**
     * 生成authcode验证码，直接输出的是图片
     * 记录在session中
     */
    public static function show(){
        $img = new Securimage();
	    $img->image_width     = 98;
		$img->image_height    = 40;
		$img->perturbation    = 0.9;      // high level of distortion
		$img->code_length     = 4; // random code length
		$img->image_bg_color  = new Securimage_Color("#ffffff");
		$img->num_lines       = 2;
		$img->noise_level     = 0.5;
		$img->text_color      = new Securimage_Color("#000000");
		$img->noise_color     = new Securimage_Color("#cccccc");
		$img->line_color      = new Securimage_Color("#cccccc");
		$img->show();
    }
    /**
     * 
     * 检验验证码是否正确，返回是否正确，false为错误验证码
     * @param 用户输入的验证码
     */
    public static function check($authcode){
        $img = new Securimage();
        return $img->check($authcode);
    }
    
}
